{% extends 'all_base.html' %}
{% load i18n %}
{% block base_content %}

    <!-- Left menu -->
    <div class="col-sm-3 col-md-2 sidebar sidebar-offcanvas" role="navigation">

        <div class="row profile_img">
            <div class="col-sm-5">

                <a href="{% url 'acc_app:setup_info' %}">
                    <img alt="profile image" class="img-circle img-responsive" src="{{ user.get_min_ava }}"/>
                </a>

            </div>
            <div class="col-sm-7">
                <b>{{ user.username }}</b><br>
                <span>{{ user.fio }}</span>
                <a href="tel:{{ user.telephone }}">{{ user.telephone }}</a>
            </div>
        </div>

        <ul class="nav nav-sidebar">

            {% url 'acc_app:accounts_list' as accounts_list %}
            <li{% if accounts_list in request.path %} class="active"{% endif %}>
                <a href="{{ accounts_list }}">
                    <span class="glyphicon glyphicon-eye-open"></span> {% trans 'Administrators' %}
                </a>
            </li>

            {% url 'abonapp:group_list' as abon_groups_link %}
            <li{% if abon_groups_link in request.path %} class="active"{% endif %}>
                <a href="{{ abon_groups_link }}">
                    <span class="glyphicon glyphicon-user"></span> {% trans 'Subscribers' %}
                </a>
            </li>

            {% if perms.taskapp.view_task %}
                {% url 'taskapp:home' as task_home %}
                <li{% if task_home in request.path %} class="active"{% endif %}>
                    <a href="{{ task_home }}">
                        <span class="glyphicon glyphicon-tasks"></span> {% trans 'Tasks' %}
                        {% if tasks_count > 0 %}<span class="badge">{{ tasks_count }}</span>{% endif %}
                    </a>
                </li>
            {% endif %}

            {% if perms.group_app.view_group %}
                {% url 'group_app:group_list' as group_list_link %}
                <li{% if group_list_link in request.path %} class="active"{% endif %}>
                    <a href="{{ group_list_link }}">
                        <span class="glyphicon glyphicon-list-alt"></span> {% trans 'Groups' %}
                    </a>
                </li>
            {% endif %}

            {% url 'tarifs:home' as tarifs_home %}
            <li{% if tarifs_home in request.path %} class="active"{% endif %}>
                <a href="{{ tarifs_home }}">
                    <span class="glyphicon glyphicon-usd"></span> {% trans 'Services' %}
                </a>
            </li>

            {% url 'ip_pool:networks' as ippool_home %}
            <li{% if ippool_home in request.path %} class="active"{% endif %}>
                <a href="{{ ippool_home }}">
                    <span class="glyphicon glyphicon-compressed"></span> {% trans 'Ip pool' %}
                </a>
            </li>

            {% if request.user.is_superuser %}
                {% url 'mapapp:options' as mapapp_ops %}
                <li{% if mapapp_ops in request.path %} class="active"{% endif %}>
                    <a href="{{ mapapp_ops }}">
                        <span class="glyphicon glyphicon-map-marker"></span> {% trans 'Map settings' %}
                    </a>
                </li>
            {% endif %}

            {% url 'msg_app:home' as privmsg_home %}
            <li{% if privmsg_home in request.path %} class="active"{% endif %}>
                <a href="{{ privmsg_home }}">
                    <span class="glyphicon glyphicon-envelope"></span> {% trans 'Messages' %}
                    {% if new_messages_count > 0 %}
                        <span class="badge">{{ new_messages_count }}</span>
                    {% endif %}
    		    </a>
            </li>

            {% if perms.traf_stat.statcache_view %}
                {% url 'traf_stat:home' as stathome %}
                <li{% if stathome in request.path %} class="active"{% endif %}>
                    <a href="{{ stathome }}">
                        <span class="glyphicon glyphicon-dashboard"></span> {% trans 'Traffic' %}
                    </a>
                </li>
            {% endif %}

            {% url 'devapp:group_list' as devapp_groups %}
            <li{% if devapp_groups in request.path %} class="active"{% endif %}>
                <a href="{{ devapp_groups }}">
                    <span class="glyphicon glyphicon-hdd"></span> {% trans 'Devices' %}
                </a>
            </li>

            {% if perms.gw_app.view_nasmodel %}
                {% url 'gw_app:home' as nashome %}
                <li{% if nashome in request.path %} class="active"{% endif %}>
                    <a href="{{ nashome }}">
                        <span class="glyphicon glyphicon-globe"></span> {% trans 'Gateways' %}
                    </a>
                </li>
            {% endif %}

            {% if perms.gw_app.view_nasmodel %}
                {% url 'messenger:messengers_list' as mesngrhome %}
                <li{% if mesngrhome in request.path %} class="active"{% endif %}>
                    <a href="{{ mesngrhome }}">
                        <span class="glyphicon glyphicon-comment"></span> {% trans 'Messengers' %}
                    </a>
                </li>
            {% endif %}

            {% url 'new_customers:customers_list' as newclist %}
            <li{% if newclist in request.path %} class="active"{% endif %}>
                <a href="{{ newclist }}">
                    <span class="glyphicon glyphicon-question-sign"></span> {% trans 'Potential subscribers' %}
                </a>
            </li>

        </ul>

    </div>
    <!-- END Left menu -->

    <!-- Main content -->
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <p class="pull-left visible-xs">
            <button type="button" data-toggle="offcanvas"></button>
        </p>

        {% block breadcrumb %}
            <ol class="breadcrumb">
                <li><span class="glyphicon glyphicon-home"></span></li>
            </ol>
        {% endblock %}

        {% include '_messages.html' %}

        <div class="page-header">
            <h3>{% block page-header %}{% endblock %}</h3>
        </div>

        {% block main %}{% endblock %}

        {% include 'pagination.html' %}

    </div>
    <!-- END Main content -->
{% endblock %}
